package com.xian.ai.code.service;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xian.ai.code.model.dto.app.AppAddRequest;
import com.xian.ai.code.model.dto.app.AppQueryRequest;
import com.xian.ai.code.model.dto.app.AppUpdateMyRequest;
import com.xian.ai.code.model.dto.app.AppUpdateRequest;
import com.xian.ai.code.model.entity.App;
import com.xian.ai.code.model.entity.User;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xian.ai.code.model.vo.AppVO;
import reactor.core.publisher.Flux;

import java.util.List;

/**
 * 应用服务层接口
 *
 * @author Zhangxn
 */
public interface AppService extends IService<App> {

    void generateAppScreenshotAsync(Long appId, String appUrl);

    /**
     * 创建应用
     *
     * @param appAddRequest 创建应用请求
     * @param loginUser 当前登录用户
     * @return 应用ID
     */
    Long addApp(AppAddRequest appAddRequest, User loginUser);
    /****
    * @description: 根据app查询请求获取wrapper
    * @param appQueryRequest
    * @return QueryWrapper<App>
    * @author Zhangxn
    * @date 2025/8/3
    */
    QueryWrapper<App> getQueryWrapper(AppQueryRequest appQueryRequest);
    /****
    * @description: 获取app隐藏信息的列表
    * @param appList
    * @return List<AppVO>
    * @author Zhangxn
    * @date 2025/8/3
    */
    List<AppVO> getAppVOList(List<App> appList);

    Page<AppVO> getAppVOPage(AppQueryRequest appQueryRequest, long pageNum, long pageSize) ;

    AppVO getAppVO(App app);

    /**
     * 根据ID获取应用
     *
     * @param id 应用ID
     * @param loginUser 当前登录用户
     * @return 应用信息
     */
    App getAppById(Long id, User loginUser);


    Flux<String> chatToGenCode(Long appId, String message, User loginUser);

    String deployApp(Long appId, User loginUser);
}